<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $uid 
 * @property int $main_uid 
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property-read null|\Hyperf\Database\Model\Collection|ChOpScheme[] $schemes 
 * @property-read null|\Hyperf\Database\Model\Collection|ChRobot[] $robots 
 */
class ChOpSchemeRobotLog extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_op_scheme_robot_log';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uid', 'main_uid', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'main_uid' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function schemes()
    {
        return $this->belongsToMany(ChOpScheme::class, 'ch_op_scheme_robot_log_scheme', 'log_id', 'scheme_id');
    }

    public function robots()
    {
        return $this->belongsToMany(ChRobot::class, 'ch_op_scheme_robot_log_robot', 'log_id', 'robot_id');
    }
}
